package cn.edu.tju.fctl.rest;

import cn.edu.tju.fctl.service.IDepartService;
import cn.edu.tju.fctl.util.ShiroUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * Created by liutong on 15/12/27.
 */
@Component
@Path("depart")
public class DepartRest {
    @Autowired
    IDepartService departService;

    @GET
    @Path("{id:[0-9]*}")
    @Produces(MediaType.APPLICATION_JSON)
    public Object getDepartByID(@PathParam("id") final int id){
        return departService.findByID(id);
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Object getDeparts(){
        return departService.findAll();
    }
}
